﻿using System;
using UniRx;
using UniRx.Triggers;
using UnityEngine;

namespace Studio
{
	// Token: 0x020005E2 RID: 1506
	public class Teleportation : MonoBehaviour
	{
		// Token: 0x0600267F RID: 9855 RVA: 0x000E1308 File Offset: 0x000DF508
		private void MoveToPoint()
		{
			Vector3 position = this.objMarker.transform.position;
			position.y = this.objCameraRig.transform.position.y;
			this.objCameraRig.transform.position = position;
			this.objMarker.SetActive(false);
		}

		// Token: 0x06002680 RID: 9856 RVA: 0x000E1364 File Offset: 0x000DF564
		private void Start()
		{
			this.objMarker.SetActive(false);
			if (this.trackedObject == null)
			{
				this.trackedObject = base.GetComponent<SteamVR_TrackedObject>();
			}
			SteamVR_Controller.Device device = SteamVR_Controller.Input((int)this.trackedObject.index);
			(from _ in this.UpdateAsObservable()
			where this.enabled
			where device.GetTouch(8589934592UL)
			select _).Subscribe(delegate(Unit _)
			{
				this.objMarker.SetActive(true);
			});
			(from _ in this.UpdateAsObservable()
			where this.enabled
			where device.GetTouchUp(8589934592UL)
			select _).Subscribe(delegate(Unit _)
			{
				this.MoveToPoint();
			});
		}

		// Token: 0x0400268C RID: 9868
		[SerializeField]
		private GameObject objCameraRig;

		// Token: 0x0400268D RID: 9869
		[SerializeField]
		private GameObject objMarker;

		// Token: 0x0400268E RID: 9870
		[SerializeField]
		private SteamVR_TrackedObject trackedObject;
	}
}
